<form name="employeejob_edit" action="" id="employeejob_edit">
	<input type="hidden" value="{{employeejobtypeid}}" id="employeejobtypeid">
	<table>
		<tr> <!--Here we have jobypes menu-->
			<td><div id="employeejob_edit_jobs_menu"></div></td>
			<td>
				<div id="employeejob_edit_currentjobtype">{{jobtypetitle}}</div>
				<input type="hidden" name="employeejob_edit_jobtypeid" id="employeejob_edit_jobtypeid" value="{{jobtypeid}}">
			</td>
		</tr>
		<tr>
			<td>_('employeejobtypestartdate')</td>
			<td><input type="text" name="employeejobtypestartdate" value="{{employeejobtypestartdate}}"></td>
		</tr>
		<tr>
			<td>_('employeejobtypeexpirationdate')</td>
			<td><input type="text" name="employeejobtypeexpirationdate" value="{{employeejobtypeexpirationdate}}"></td>
		</tr>
		<tr>
			<td>_('employeejobtypeactive')</td>
			<td><input type="checkbox" name="employeejobtypeactive">{{employeejobtypeactive}}</td>
		</tr>
		<tr>
			<td></td>
			<td>
				<button type="button" class="btn btn-default btn-lg" onClick="createOrUpdateEmployeeJobType()">
					<span class="glyphicon glyphicon-ok"></span> _('save')
				</button>
				<button type="button" class="btn btn-default btn-lg" onClick="closeDialog()">
					<span class="glyphicon glyphicon-remove"></span> _('cancel')
				</button>
			</td>
		</tr>
	</table>
</form>
<script>
$('#employeejob_edit_currentjobtype').on('jobtypes_menu_selected', function(event, newJobTypeId, newJobTypeTitle)
{	
	$('#employeejob_edit_currentjobtype').text(newJobTypeTitle);
	$('#employeejob_edit_jobtypeid').val(newJobTypeId);
});

function createOrUpdateEmployeeJobType()
{
	var data = $('#employeejob_edit').serialize();
	var employeeJobTypeID = $("#employeejob_edit #employeejobtypeid").val();
	if(employeeJobTypeID)
	{
		updateEmployeeJobType(data);
	}
	else
	{
		createEmployeeJobType(data);
	}
}

function closeDialog()
{
	$('#employeejobedit_dialog').dialog('close');
}
</script>

